<?php
$config = [
    'id' => 'gxq',
    'language' => 'zh-CN',
    'basePath' => SYS_ROOT,
    'vendorPath' => YII_ROOT,
    'bootstrap' => ['log'],
    'defaultRoute' => 'activity',
    'modules' => [
        'admin' => ['class' => 'app\modules\admin\Module'],
    ],
    'extensions' => [],
    'as behaviors' => ['class' => 'app\components\BaseBehavior'],
    'components' => [
        'assetManager' => require(__DIR__ . '/asset.php'),
        'log' => require(__DIR__ . '/log.php'),
        'urlManager' => require(__DIR__ . '/url.php'),
        'formatter' => [
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss',
            'dateFormat' => 'yyyy-MM-dd',
        ],
        'cache_db_schema' => require(__DIR__ . '/cache_db_schema.php'),
        'cache' => require(__DIR__ . '/cache.php'),
        'request' => [
            'cookieValidationKey' => APP_KEY,
        ],
        'errorHandler' => [
            'class' => 'app\components\BaseErrorHandler'
        ],
        'setting' => [
            'class' => 'app\models\Setting'
        ],
        'weixin' => [
            'class' => 'app\extensions\weixin\WeiXin',
            'appId' => 'wx16d4d5112b2060a8',
            'appSecret' => 'b13a948fe3dd1d8c57a8fb09c43dfa4c',
            'token' => '9264454449acc37b5768412be7800f92',
        ],
        'user' => [
            'identityClass' => 'app\models\User',
            'identityCookie' => ['name' => '__user', 'httpOnly' => TRUE],
            'idParam' => '_userId',
            'enableAutoLogin' => TRUE,
            'loginUrl' => ['/auth/login'],
        ],
        'authClientCollection' => [
            'class' => 'yii\authclient\Collection',
            'clients' => [
                'weixin' => [
                    'class' => 'yii\authclient\clients\Wechat',
                    'clientId' => 'wx16d4d5112b2060a8',
                    'clientSecret' => 'b13a948fe3dd1d8c57a8fb09c43dfa4c',
                ]
            ]
        ]
    ],
];

if (YII_ENV_DEV) {
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'allowedIPs' => ['*']
    ];

}
if (file_exists(__DIR__ . '/db.php')) {
    $config['components']['db'] = require(__DIR__ . '/db.php');
}
return $config;